package com.pxmeta.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.pxmeta.order.dto.RequestRefundDTO;
import com.pxmeta.order.entity.OrderEvaluate;
import com.pxmeta.order.entity.UserOrderRecord;
import com.pxmeta.order.dto.OrderEvaluateDTO;
import com.pxmeta.order.vo.OrderDetailVO;
import com.pxmeta.order.vo.OrderEvaluateVO;
import com.pxmeta.skill.entity.UserSkill;
import com.pxmeta.skill.entity.vo.OrderProgressVO;

import java.util.List;

public interface IUserOrderRecordService extends IService<UserOrderRecord> {

    /**
     * 保存连线记录
     * @param userId
     * @param targetUserId
     * @return
     */
    Long saveRecord(Long userId, Long targetUserId, Integer type);

    /**
     * 打分
     * @param recordId
     * @param score
     */
    void scoring(Long recordId, Integer score);

    /**
     * 连线扣费
     * @param userId
     * @param recordId
     */
    void charging(Long userId, Long recordId, Long servicePriceId);

    /**
     * 获取订单数
     * @param userId
     * @return
     */
    Long getOrderCount(Long userId);

    /**
     * 订单评价
     * @param userId
     * @param evaluateDTO
     */
    void evaluate(Long userId, OrderEvaluateDTO evaluateDTO);

    /**
     * 创建订单
     * @param userId
     * @param userSkillId
     * @param count
     */
    Long createOrder(Long userId, Long userSkillId, Integer count, String partyId);

    /**
     * 获取订单进度
     * @param username
     * @return
     */
    OrderProgressVO getOrderProgress(Long currentUserId,String username);

    /**
     * 接单
     * @param userId
     * @param orderId
     */
    void receivingOrder(Long userId, Long orderId);

    /**
     * 拒单
     * @param userId
     * @param orderId
     */
    void refuseOrder(Long userId, Long orderId);

    /**
     * 完成订单
     * @param userId
     * @param orderId
     */
    void completeOrder(Long userId, Long orderId);

    /**
     * 获取订单详情
     * @param orderId
     * @return
     */
    OrderDetailVO getOrderDetail(Long orderId);

    /**
     * 获取订单列表
     * @param type 1我的下单，2我的接单
     * @return
     */
    List<OrderDetailVO> getOrderList(Long userId, Integer type, Integer page, Integer size);

    /**
     * 获取评价列表
     * @param targetUserId
     * @return
     */
    List<OrderEvaluateVO> getEvaluateList(Long targetUserId, Integer skillId, Integer page, Integer size);

    /**
     * 判断是否是第一次下单
     * @param currentUserId
     * @param userId
     * @param skillId
     * @return
     */
    Boolean checkFirstPay(Long currentUserId, Long userId, Integer skillId);

    /**
     * 判断满足首单一币
     * @return
     */
    Boolean checkFirstPayOneCoinToday(Long buyerId);

    /**
     * 申请退款
     * @param userId
     * @param orderId
     */
    void requestRefund(Long userId, RequestRefundDTO dto);

    /**
     * 同意退款
     * @param userId
     * @param orderId
     */
    void confirmRefund(Long userId, Long orderId);

    /**
     * 拒绝退款
     * @param userId
     * @param orderId
     */
    void refuseRefund(Long userId, Long orderId);


    /**
     * 取消订单
     * @param userId
     * @param orderId
     */
    void cancelOrder(Long userId, Long orderId);


    /**
     * 获取超时订单
     * @return
     */
    List<UserOrderRecord> getOvertimeOrders();
}
